import http from "./http";

const getAbsentTypes = () => {
    const path = "/absent/type"
    return http.get(path)
}

const getResponser = () => {
    const path = "/absent/responser"
    return http.get(path)
}

const applyAbsent = (data) => {
    const path = "/absent/absent"
    return http.post(path,data)
}

const getMyAbsents = (page=1) => {
    const path = "/absent/absent?who=my&page="+page
    return http.get(path)
}

const getSubAbsents = (page=1) => {
    const path = "/absent/absent?who=sub&page="+page
    return http.get(path)
}

const handleSubAbsent = (absent_id, status, response_content) => {
    const path = "/absent/absent/"+ absent_id
    return http.put(path, {status,response_content})
}

export default{
    getAbsentTypes,
    getResponser,
    applyAbsent,
    getMyAbsents,  
    getSubAbsents,
    handleSubAbsent
}